<template>
    <view>
        <form>
          <xmInfo
            :projectno="dataInfo.projInfo.projectno"
            :projectname="dataInfo.projInfo.projectname"
          ></xmInfo>
    <!-- v-if="status != vuex_config.zgStatus" -->
          <view class="cu-card">
            <view class="cu-form-group ">
                <view class="title">文件类型</view>
                <view>{{ dataInfo.projFilesCls.name }}</view>
            </view>
            <view class="cu-form-group" style="min-height: 0;"></view>

            <view class="cu-bar bg-white">
                <view class="action">附件上传</view>
            </view>
            <!-- <view class="cu-bar bg-white">
            <js-uploadfile v-model="dataInfo.dataMap" :biz-key="dataInfo.id" biz-type="ProjectPushBz_file"></js-uploadfile>
            </view> -->
            <!-- <file-upload :uploadOptions="uploadOptions" :imgList="imgList" @imgListChange="imgListChange"></file-upload> -->
             <!-- customBtn="false" -->
            <view class="cu-form-group">
              <js-uploadfile
				  v-model="dataInfo.dataMap"
                  :biz-key="dataInfo.id"
                  :biz-type="'pmProjFiles_file_'+ dataInfo.fileType"
                  :deletable="dataInfo.status == 5 ||dataInfo.status == 6  ? true : false"
                  :customBtn = "dataInfo.status == 5 ||dataInfo.status == 6  ? false : true"
                ></js-uploadfile>
            </view>
			<!-- <view class="cu-form-group">
			  <view class="title">备注</view>
			  <textarea
			    maxlength="-1"
			    placeholder="请输入"
			    v-model="dataInfo.remarks"
			  ></textarea>
			</view> -->
            <view class="cu-form-group">
              <view style=" display: inline-block;padding: 5px;background: #0081ff;color: #fff;text-align: center;font-style: italic;font-weight: bold">
                  执行信息
                </view>
            </view>
            <view class="cu-form-group ">
                <view class="title">文件状态</view>
                <view>
                  <js-select v-model="dataInfo.fileStatus" dict-type="zf_file_status" placeholder="请选择选项" :disabled="true"></js-select>
                </view>
            </view>
            <view class="cu-form-group ">
                <view class="title">创建日期</view>
                <view>{{ dataInfo.createDate }}</view>
            </view>
            <view class="cu-form-group ">
                <view class="title">确认日期</view>
                <view>{{ dataInfo.auditDate }}</view>
            </view>
            <view class="cu-form-group ">
                <view class="title">确认人</view>
                <view>{{ dataInfo.auditByName }}</view>
            </view>
          </view>
          
          <!-- v-if="status == vuex_config.zgStatus" v-if="flag"-->

          <view class="btn-group cu-bar foot">            
            <js-bpm-button   v-model="dataInfo.bpm"  :biz-key="dataInfo.id"  :form-key="'Flow_proj_file_' + dataInfo.fileType"  @complete="submit" ></js-bpm-button>
          </view>

        </form>
    </view>
</template>
<script>
import xmInfo from "@/pages/zfgs/index/componetns/xmInfo.vue";
import {hasPermission} from '@/common/fire.js'
export default {
  components: { xmInfo },
  data() {
    return {
      startTime: false, //控制日期显示
      switchA: false,
      modalName: null,
      uploadOptions: {},
      modalNameDetail: null,
      showAddDetail: false,
      dataInfo: {},
      showButton: true,
      flag: hasPermission('btn:add:edit'),
      status: "",
      projectno: "",
      projectname: "",
    };
  },
  onLoad(params) {
    let obj = {};
    if (params.id) {
      obj = params;
    } else {
      let item = JSON.parse(params.item);
      obj = {
        projectno: item.projectno,
        name: item.projectname,
      };
      this.projectno = item.projectno;
      this.projectname = item.projectname;
    }
    this.status = params.status;

    this.$u.api.zfgs.pmProjFilesForm(obj).then((res) => {
      this.dataInfo = res.pmProjFiles;
      this.dataInfo.projectno = this.dataInfo.projectno
        ? this.dataInfo.projectno
        : this.projectno;
      this.dataInfo.name = this.dataInfo.name
        ? this.dataInfo.name
        : this.projectname;
      console.log(this.dataInfo);
    });
  },
  methods: {
    submit() {
      if (this.isSubmitting) {
        return;
      } else {
        this.isSubmitting = true;
        try {
			this.dataInfo.status = 4
          // 去除this.dataInfo.status 属性
          this.$u.api.zfgs.pmProjFilesSave(this.dataInfo).then((res) => {
            if (res.result == "true") {
              this.$u.toast(res.message);
              setTimeout(() => {
                uni.navigateBack({
                  delta: 1,
                });
                // uni.navigateTo({
                //   url: "pages/zfgs/index/daiban/list",
                // });
              }, 500);
            } else {
              uni.showModal({
                title: "提示",
                content: res.message,
                showCancel: false,
                success: (res) => {},
              });
            }
          });
        } catch (error) {
          this.$u.toast(error.message);
        } finally {
          this.isSubmitting = false;
        }
      }
    },


  },
};
</script>
<style lang="scss" scoped>
.pre {
  // 空格或者换行符换行
  white-space: pre-wrap;
}
/deep/.u-input__input.data-v-460c1d26 {
  text-align: right !important;
}
.action {
  color: #303133;
}
.title {
  flex-shrink: 0;
}
.text-sl {
  font-size: 22px !important;
}
.cu-bar1 {
  min-height: 80px;
}
.cu-btn {
  font-size: 16px;
  height: 40px;
}
.foot {
  z-index: 997;
  background: #fff;
}
.green {
  color: green;
}
.input-align {
  text-align: right;
}
::v-deep .u-input__input {
  text-align: right;
}
.text-xs {
  font-size: 18rpx !important;
}
</style>